<?php
	$success = null;

	// Upon form submission...
	if ($_POST) {
		
		// Retrieve POST vars
		$name = $_POST['name'];
		$email = $_POST['email'];
		$phone = $_POST['phone'];
		$call_from = $_POST['call_from'];
		$call_until = $_POST['call_until'];
		$state = $_POST['state'];
		$message = stripslashes($_POST['message']);
		//$terms = $_POST['terms'];
		
		// Set up email params
		$headers  = "From: \"ClaimEverything.com\" <info@claimeverything.com> \r\n";
		$headers .= "Reply-To: info@claimeverything.com \r\n";
		$headers .= "Return-Path: info@claimeverything.com \r\n";
		$headers .= "Organization: Sender Organization\r\n";
		$headers .= "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
		$headers .= "Content-Transfer-Encoding: binary\r\n";
		$headers .= "X-Priority: 3\r\n";
		$headers .= "X-Mailer: PHP" . phpversion() ."\r\n";
		
		$to = 'austincaine@gmail.com'; 
		$subject = 'ClaimEverything.com Submission';
		
		// Set up email body
		$body = "
<p>
	The following information was submitted via ClaimEverything.com
	<br/><br/>
	===================================================<br/>
	<strong>Name:</strong> ".$name."<br/>
	<strong>Email:</strong> ".$email."<br/>
	<strong>Phone:</strong> ".$phone."<br/>
	<strong>Call Between:</strong> ".$call_from." and ".$call_until."<br/>
	<strong>State:</strong> ".$state."<br/>
	<strong>Message:</strong> ".$message."<br/>
	===================================================
</p>
		";
		
		if (mail ($to, $subject, $body, $headers)) { 
			$success = true;
		} else { 
			$success = false;
		}
	}
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="author" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="favicon.ico">

	<title>Personal Property Consultants :: ClaimEverything.com</title>
	
	<!-- jQuery and jQuery UI -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
	<script src="js/jquery-ui.min.js"></script>
	<link href="css/jquery-ui.min.css" rel="stylesheet">
	<link href="css/jquery-ui.structure.min.css" rel="stylesheet">
	<link href="css/jquery-ui.theme.min.css" rel="stylesheet">
	
	<!-- Bootstrap -->
	<script src="js/bootstrap.min.js"></script>
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/bootstrap-theme.min.css" rel="stylesheet">
	
	<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
	<script src="js/ie10-viewport-bug-workaround.js"></script>
	
	<!-- jQuery TimePicker -->
	<script src="js/jquery.timepicker.min.js"></script>
	<link href="css/jquery.timepicker.min.css" rel="stylesheet">
	
	<!-- Custom styles for this template -->
	<link href="css/style.css" rel="stylesheet">

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
	<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<style>
		.contact-sidebar label
		{
			display: block;
		}
	</style>
	<![endif]-->
</head>
<body role="document">
<a name="top"></a>

<style>
.container-responsive
{
	padding: 0 10px;
	max-width: 960px;
	margin: auto;
}
</style>

<div class="header">
	<div class="container-responsive align-center">
		<a class="logo" href="index.php"><img src="img/logo.png"></a>
	</div> <!-- /.contianer -->
</div> <!-- /.header -->

<div class="navbar"></div>
<div class="main">

<div style="height: 50px;"></div>

<?php if ($_POST): ?>

	<div class="container-responsive">	
		<div class="row"> 
			<div class="col-xs-12">
				
				<?php if ($success): ?>
					<h1 style="font-weight: bold; color: #090; text-align: center;">Thank you for contacting us!</h1>
					<p class="bg-success text-success" style="font-size:14pt; padding: 2em; margin: 0 5em;">
						We have received your submission and will review it right away. Please allow 1-2 business days for a call back from one of our representatives. And thank you again for choosing ClaimEverything.com for your personal property claim needs.
					</p>
				<?php else: ?>
					<h1 style="font-weight: bold; color: #c00; text-align: center;">Uh oh! Something went wrong.</h1>
					<p class="bg-danger text-danger" style="font-size:14pt; padding: 2em; margin: 0 5em;">
						We apologize but it seems our online form has experienced some sort of hiccup. Please copy the message transcript below and send it manually via email to
						<span style="display: block;" class="align-center">
							<strong style="text-align: center; font-size:18pt;">info@claimeverything.com</strong>
						</span>
					</p>
					<br/><br/>
					<p class="well">
						<strong>Name:</strong> <?php echo $name; ?><br/>
						<strong>Email:</strong> <?php echo $email; ?><br/>
						<strong>Phone:</strong> <?php echo $phone; ?><br/>
						<strong>Call Between:</strong> <?php echo $call_from; ?> and <?php echo $call_until; ?><br/>
						<strong>State:</strong> <?php echo $state; ?><br/>
						<strong>Message:</strong> <?php echo $message; ?><br/>
					</p>
				<?php endif; ?>
			</div>
		</div>
	</div>


<?php else: ?>

	<div class="container-responsive">	
			<div class="row"> 
				<div class="col-xs-12 col-sm-6">
					<h1><span style="font-weight: bold; color: #090;">Greetings, Friends!</span><br><br>Our Website is Currently Under Construction...</h1>
					<h2>However We Can Still Help.</h2>
					<h3>Fill out this simple form with a brief description of your situation and we will phone you back as soon as possible to schedule your free consultation.</h3>
					<h4><br>(We will NEVER send you SPAM or sell your email)</h4>
				</div> <!-- /.col-xs-6 -->
				<div class="col-xs-12 col-sm-6">
	  
					<div class="panel panel-primary">
						<div class="panel-body">
							
							<form class="contact-sidebar" action="comingsoon.php" method="POST" enctype="multipart/form-data">
							
								<div class="form-group">
									<label for="name">What is your full name?</label>
									<input type="text" class="form-control" name="name" id="name" placeholder="What is your name?" required="required">
								</div>

								<div class="form-group">
									<label for="email">What is your email address?</label>
									<input type="email" class="form-control" name="email" id="email" placeholder="What is your email address?" required="required">
								</div>

								<div class="form-group">
									<label for="phone">What is your phone number?</label>
									<input type="text" class="form-control" name="phone" id="phone" placeholder="What is your phone number?" required="required">
								</div>
								
								<div class="form-group calltimes">
									<label for="call_from" style="display: block !important">Which times are best to call? (click to change)</label>
									Between <input type="text" class="call-from form-control" name="call_from" id="call_from">
									and	<input type="text" class="call-until form-control" name="call_until" id="call_until">
									<script>
										$(document).ready(function(){
											$('input.call-from').timepicker({
												defaultTime: new Date(0,0,0,8,0,0),
											});
											$('input.call-until').timepicker({
												defaultTime: new Date(0,0,0,18,0,0),
											});
										});
									</script>
								</div>
								
								<div class="form-group">
									<select name="state" id="state" class="form-control placeholder" required="required">
										<option selected disabled value="">In which state do you live?</option>
										<option value="AL">Alabama</option>
										<option value="AK">Alaska</option>
										<option value="AZ">Arizona</option>
										<option value="AR">Arkansas</option>
										<option value="CA">California</option>
										<option value="CO">Colorado</option>
										<option value="CT">Connecticut</option>
										<option value="DE">Delaware</option>
										<option value="DC">District Of Columbia</option>
										<option value="FL">Florida</option>
										<option value="GA">Georgia</option>
										<option value="HI">Hawaii</option>
										<option value="ID">Idaho</option>
										<option value="IL">Illinois</option>
										<option value="IN">Indiana</option>
										<option value="IA">Iowa</option>
										<option value="KS">Kansas</option>
										<option value="KY">Kentucky</option>
										<option value="LA">Louisiana</option>
										<option value="ME">Maine</option>
										<option value="MD">Maryland</option>
										<option value="MA">Massachusetts</option>
										<option value="MI">Michigan</option>
										<option value="MN">Minnesota</option>
										<option value="MS">Mississippi</option>
										<option value="MO">Missouri</option>
										<option value="MT">Montana</option>
										<option value="NE">Nebraska</option>
										<option value="NV">Nevada</option>
										<option value="NH">New Hampshire</option>
										<option value="NJ">New Jersey</option>
										<option value="NM">New Mexico</option>
										<option value="NY">New York</option>
										<option value="NC">North Carolina</option>
										<option value="ND">North Dakota</option>
										<option value="OH">Ohio</option>
										<option value="OK">Oklahoma</option>
										<option value="OR">Oregon</option>
										<option value="PA">Pennsylvania</option>
										<option value="RI">Rhode Island</option>
										<option value="SC">South Carolina</option>
										<option value="SD">South Dakota</option>
										<option value="TN">Tennessee</option>
										<option value="TX">Texas</option>
										<option value="UT">Utah</option>
										<option value="VT">Vermont</option>
										<option value="VA">Virginia</option>
										<option value="WA">Washington</option>
										<option value="WV">West Virginia</option>
										<option value="WI">Wisconsin</option>
										<option value="WY">Wyoming</option>
									</select>
								</div>

								<div class="form-group">
									<label for="message">Please describe your situation...</label>
									<textarea name="message" id="message" class="form-control" placeholder="Please describe your situation..." rows="5" required="required"></textarea>
								</div>
								
								<div class="form-group hidden">
									<input type="checkbox" name="terms" id="terms">
									<label style="font-weight: normal; display: inline !important;" for="terms">I understand and accept <a id="terms-link" href="javascript:void(0);">these terms of use</a>.</label>	
									<div id="terms-dialog">
										<p>Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing</a> elit. Quisque at luctus turpis. Suspendisse sed sapien nunc. Nullam fringilla justo vel laoreet finibus. Aenean porta nisl ac feugiat ullamcorper. Morbi venenatis tortor risus, et viverra ligula volutpat a. Pellentesque hendrerit erat nec sagittis commodo. Fusce vel posuere lectus, a scelerisque mi. Nunc eu porttitor metus. Morbi non neque ut ipsum sagittis sodales. Vestibulum feugiat molestie velit. Cras quis massa enim. Nullam et aliquet metus. Nullam tincidunt mollis leo at rutrum.</p>
										<p>In sed nibh non velit tristique feugiat nec vitae enim. Sed dictum quam ac ante venenatis, ac porta turpis mollis. Aliquam ut urna nibh. Ut imperdiet quam condimentum porttitor maximus. Praesent nec volutpat purus. Fusce sodales velit quis venenatis auctor. Vivamus cursus pulvinar urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce ex ante, finibus in diam pellentesque, accumsan tincidunt erat. Donec felis ligula, sodales aliquet blandit sed, bibendum vel libero. Donec leo nisi, ornare eget interdum eget, tempus sit amet neque. Morbi eget erat sit amet felis tempor ultrices ac id dui. Curabitur velit libero, molestie eu dignissim at, tempus sit amet diam. Nullam ut sodales orci, a ornare felis.</p>
										<script>
											$(function() {
												$( "#terms-dialog" ).dialog({
													autoOpen: false,
													modal: true,
													resizable: false,
													draggable: false,
													width: 600,
													title: "Terms of Use",
												});

												$( "#terms-link" ).click(function() {
													$( "#terms-dialog" ).dialog( "open" );
												});
												
												$( ".ui-widget-overlay" ).click(function() {
													alert('clicked');
												});

											});
										</script>
									</div>
								</div>
								
								<button type="submit" name="submit" class="btn btn-warning pull-right">Send Message &raquo;</button>
							</form>
							
						</div>
					</div>





			</div> <!-- /.col-xs-6 -->
		</div> <!-- /.row -->
	</div> <!-- /.contianer -->

<?php endif; ?>

</div> <!-- /.main -->

<div class="footer">
	<div class="container-responsive">
		
		<div class="footer-nav clearfix">
		
			<p class="align-center">
				© Copyright <?php echo date('Y', time()); ?>, ClaimEverything.com. All Rights Reserved.
			</p>
			
		</div>
		
	</div>
</div>

	
	
	
	
	
	
</body>
</html>
